from django.core.mail import send_mail
from django.conf import settings
from celery_tasks.sms.tasks import celery_app


@celery_app.task(name='ccp_send_sms_code')
def send_verift_email(email, url):
    # 邮件标题
    subject = "美多商城邮箱验证"

    # 邮件内容
    html_message = f'''
        <p>尊敬的用户您好！</p>
        <p>感谢您使用美多商城。</p>
        <p>您的邮箱为：{email} 。请点击此链接激活您的邮箱：</p>
        <p><a href={url}>{url}<a></p>
        '''

    # 发送邮件
    result = send_mail(subject, '', settings.EMAIL_FROM, [email], html_message=html_message)

    return result
